<?php
$is_activate = 1;
$login_start = 30;
$filename = "need_logins.txt";
$temp_dir = "temp-www/ya-check/";
include_once("../class_main_curl.php");
include_once("../functions.php");
$d[0]['chk'] = 1;
$d[0]['url'] = "http://vkontakte.ru/login.php";
$d[0]['fnm'] = $temp_dir."index.html";

$fd = fopen($filename, 'r');
$logins = fread($fd, filesize($filename));
fclose($fd);
$logins = split("\n", $logins);
for($login = $login_start; $login < count($logins); $login++) {
	$my_box = imap_open("{pop.yandex.ru/pop3:110}", $logins[$login], "blablabla", OP_SILENT);
	if($is_activate == 1) { 
		$h     = iconv("koi8-r", "UTF-8", imap_body($my_box, 2));
		if(strpos($h, "http://vkontakte.ru/confirm.php?code=") == FALSE) {
			$h     = iconv("koi8-r", "UTF-8", imap_body($my_box, 1));
			if(strpos($h, "http://vkontakte.ru/confirm.php?code=") == FALSE) {
				$h     = iconv("koi8-r", "UTF-8", imap_body($my_box, 3));
			}
		}
		$vkinv = substr($h, strpos($h, "http://vkontakte.ru/confirm.php?code="), 69);
		echo $vkinv." ";
		$d[0]['url'] = $vkinv;
		multicurl($d);
	} 	
	echo imap_num_msg($my_box)."[".$login."] [".$logins[$login]."]<BR>\n";
	//if($is_activate == 1) { ob_flush(); flush(); }
	imap_close($my_box);
} 
?>

